<template>
  <span class="mui-numbox" data-numbox-min="1">
    <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
    <input
      id="test"
      class="mui-input-numbox"
      type="number"
      value="1"
      @change="Count()"
      ref="numbox"
    >
    <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
  </span>
</template>
<script>
import mui from "../../lib/mui/js/mui.js";

export default {
  mounted() {
    mui(".mui-numbox").numbox();
  },

  data() {
    return {};
  },
  methods: {
    Count() {
      this.$emit("getCount", parseInt(this.$refs.numbox.value));
      // console.log(this.$refs.numbox.value)
    }
  },
  props: ["max"],
  watch: {
    max: function(newVal, OldVal) {
      mui(".mui-numbox")
        .numbox()
        .setOption("max", this.max);
        console.log(newVal)
    }
  }
};
</script>
<style lang="scss" scoped>
.mui-numbox {
  height: 20px;
  input {
    font-size: 12px;
  }
}
</style>
